package com.wzdigit.wms.basic.enums;

import java.util.*;

/**
 * 收货通知单货品清单（条码状态）
 * @author Administrator
 *
 */
public enum DeliveryScanStatusEnum implements BaseEnum{

    NO_SCAN(0, "未扫描", "Status"),
    YES_SCAN(1, "已扫描", "Status"),
    NO_CONFIRM(0, "未确认", "Status"),
    YES_CONFIRM(1, "已确认", "Status");


    /**
     * 枚举值
     */
    public int code;

    /**
     * 枚举名称
     */
    public String enumName;

    /**
     * 枚举实体类属性描述
     *
     * @return
     */
    public String description;


    DeliveryScanStatusEnum(String enumName, String description) {
        this.enumName = enumName;
        this.description = description;
    }

    DeliveryScanStatusEnum(int code, String enumName, String description) {
        this.code = code;
        this.enumName = enumName;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static DeliveryScanStatusEnum getEnumByCode(int enumCode) {
        DeliveryScanStatusEnum[] values = DeliveryScanStatusEnum.values();
        DeliveryScanStatusEnum samplingEnum = null;

        for (DeliveryScanStatusEnum value : values) {
            if (value.getCode() == enumCode) {
                samplingEnum = value;
            }
        }
        return samplingEnum;
    }

    public static DeliveryScanStatusEnum getEnumByName(String enumName) {
        DeliveryScanStatusEnum[] values = DeliveryScanStatusEnum.values();
        DeliveryScanStatusEnum repairEnum = null;

        for (DeliveryScanStatusEnum value : values) {
            if (value.getEnumName() == enumName) {
                repairEnum = value;
            }
        }
        return repairEnum;
    }

    public String getEnumName() {
        return enumName;
    }

    public void setEnumName(String enumName) {
        this.enumName = enumName;
    }

    public static Map<Integer, String> getEnumByDescription(String enumDescription) {
        Map<Integer, String> enumMap = new HashMap<>();

        DeliveryScanStatusEnum[] values = DeliveryScanStatusEnum.values();
        for (DeliveryScanStatusEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)) {
                enumMap.put(value.getCode(), value.getEnumName());
            }
        }
        return enumMap;
    }

    public static Integer getCodeByEnumNameAndDescription(String enumName, String enumDescription) {
        DeliveryScanStatusEnum[] values = DeliveryScanStatusEnum.values();
        for (DeliveryScanStatusEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)
                    && Objects.equals(value.getEnumName(), enumName)) {
                return value.getCode();
            }
        }
        return null;
    }


    public static List<Map<String, Object>> getEnumListByDescription(String enumDescription) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        DeliveryScanStatusEnum[] values = DeliveryScanStatusEnum.values();
        for (DeliveryScanStatusEnum value : values) {
            if (Objects.equals(value.getDescription(), enumDescription)) {
                Map<String, Object> enumMap = new HashMap<String, Object>(2);
                enumMap.put("code", value.getCode());
                enumMap.put("name", value.getEnumName());
                list.add(enumMap);
            }
        }
        return list;
    }

}
